function MainAssistant(argFromPusher) {}

MainAssistant.prototype = {
	log: function( msg ) {
		try {
			Mojo.Log.info( "[__________ " + msg + " __________]" );
		} catch( error ) {
			// WTF
		}
	},
	setup: function() {
		Ares.setupSceneAssistant(this);
		/***/
		try {
			this.controller.setupWidget( Mojo.Menu.appMenu, App.appMenuAttr, App.appMenuModel );
		} catch( err ) {
			this.log( err.message );
		}
		/***/
		this.onLoadModel = {
			items: [
				{ checked: false, id: 0, priority: 1, name: "apple", tags: "tag1, tag2, tag3, tag4, tag5" },
				{ checked: false, id: 1, priority: 2, name: "banana", tags: "tag1, tag2, tag3, tag4, tag5" },
				{ checked: false, id: 2, priority: 3, name: "strawberry", tags: "tag1, tag2, tag3, tag4, tag5" },
				{ checked: false, id: 3, priority: 4, name: "orange", tags: "tag1, tag2, tag3, tag4, tag5" }
			]
		};
		// Override defaults in Ares setup of widget
		this.controller.setWidgetModel( 'taskItemList', this.onLoadModel );
		this.taskItemListModel = null;
		/***/
		this.controller.setupWidget( Mojo.Menu.viewMenu, {},
			{
				visible: true,
				items: [
					{
						label:'My Top Menu',
						items: [
							{ label: "Se", command: 'select-menu', width: 80 },
							{ label: "Inbox 2", command: 'title-menu', width: 160 },
							{ label: "So", command: 'sort-menu', width: 80 }
						]
					}
				]
			}
		);
		/***/
		this.controller.setupWidget( Mojo.Menu.commandMenu, {},
			{
				visible: true,
						items:
						[
							{ label: 'My Command Menu',
							items: [
								{ label: "Complete", command: 'completeTasks', width: 120 },
								{ label: "Postpone", command: 'postponeTasks', width: 110 },
								{ label: "More", command: 'more-menu', width: 90 }
							] }
						]
			}
		);
		/***/
	},
	cleanup: function() {
		Ares.cleanupSceneAssistant(this);
	},
	handleCommand: function(event) {  
		if (event.type === Mojo.Event.command) {
			switch (event.command) {
				case 'more-menu':
					var near = event.originalEvent && event.originalEvent.target;
					this.controller.popupSubmenu({
						onChoose: function( value ) { this.log( 'Selected: ' + value ) },
						placeNear: near,
						items: [
							{ label: $L("Other Actions...."), command: "moreActions" }
						]
					});
					break;
				case 'select-menu':
					var near = event.originalEvent && event.originalEvent.target;
					this.controller.popupSubmenu({
						onChoose: function( value ) { this.log( 'Selected: ' + value ) },
						placeNear: near,
						items: [
							{ label: $L("All Tasks"), command: "selectAll" },
							{ label: $L("Due Today"), command: "selectToday" },
							{ label: $L("Due Tomorrow"), command: "selectTomorrow" },
							{ label: $L("Overdue"), command: "selectOverdue" },
							{ label: $L("None"), command: "selectNone" }
						]
					});
					break;
				case 'sort-menu':
					var near = event.originalEvent && event.originalEvent.target;
					this.controller.popupSubmenu({
						onChoose: function( value ) { this.log( 'Selected: ' + value ) },
						placeNear: near,
						items: [
							{ label: $L("Name"), command: "sortByName" },
							{ label: $L("Priority"), command: "sortByPriority" },
							{ label: $L("Due Date"), command: "sortByDate" },
							{ label: $L("Default"), command: "sortByDefault" }
						]
					});
					break;
				case 'title-menu':
					var near = event.originalEvent && event.originalEvent.target;
					this.controller.popupSubmenu({
						onChoose: function( value ) { this.log( 'Selected: ' + value ) },
						placeNear: near,
						items: [
							{ label: $L("Dynamic from users lists"), command: "changeList" }
						]
					});
					break;
				case 'appMenu-prefs':
					Mojo.Controller.stageController.pushScene({name: "prefs", disableSceneScroller: true});
					break;
				case 'appMenu-help':
					Mojo.Controller.stageController.pushScene({name: "help", disableSceneScroller: true});
					break;
				default:
					break;
			}
		}
	},
};